package com.zh.excel.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zh.common.entity.JSONResult;
import com.zh.excel.service.VirtualTransExcelService;
import com.zh.excel.entity.VirtualRechargeTrans;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * code is far away from bug with the animal protecting
 * ┏┓　　　┏┓
 * ┏┛┻━━━┛┻┓
 * ┃　　　　　　　┃
 * ┃　　　━　　　┃
 * ┃　┳┛　┗┳　┃
 * ┃　　　　　　　┃
 * ┃　　　┻　　　┃
 * ┃　　　　　　　┃
 * ┗━┓　　　┏━┛
 * 　　┃　　　┃神兽保佑
 * 　　┃　　　┃代码无BUG！
 * 　　┃　　　┗━━━┓
 * 　　┃　　　　　　　┣┓
 * 　　┃　　　　　　　┏┛
 * 　　┗┓┓┏━┳┓┏┛
 * 　　　┃┫┫　┃┫┫
 * 　　　┗┻┛　┗┻┛
 *
 * @Description: 商户交易报表导出控制器
 * @Author: Li.HuiNeng
 * @Create in: 2020-02-22 16:38
 * @Version: 1.0.1
 */
@Api(value = "商户交易报表导出控制器", produces = "application/json", tags = {"商户交易报表导出控制器"})
@RestController
@RequestMapping("/vtExcel")
public class VirtualTransExcelController {

    @Autowired
    private VirtualTransExcelService service;

    @ApiOperation(value = "分页查询提现日汇总数据集", tags = {"getVirtualTransExcelPagesDay"}, notes = "分页查询提现日汇总数据集")
    @GetMapping("/getVirtualTransExcelPagesDay")
    public JSONResult<List<VirtualRechargeTrans>> getVirtualTransExcelPagesDay(
            @ApiParam(value = "起始页", name = "pageNo") Integer pageNo,
            @ApiParam(value = "当前页显示数量", name = "pageSize") Integer pageSize,
            @ApiParam(value = "账户信息实体类", name = "VirtualRechargeTrans") VirtualRechargeTrans virtualRechargeTrans) {
        JSONResult<List<VirtualRechargeTrans>> jsonResult = new JSONResult<>();
        try {
            IPage<VirtualRechargeTrans> result = this.service.selectVirtualTransExcelPagesDay(new Page<>(pageNo, pageSize), virtualRechargeTrans);
            jsonResult.setTotal(result.getTotal());
            jsonResult.setData(result.getRecords());
            jsonResult.setMessage("操作成功");
            jsonResult.setSuccess(true);
            jsonResult.setCode(200);
        } catch (Exception e) {
            jsonResult.setMessage(e.getLocalizedMessage());
            jsonResult.setSuccess(false);
            e.printStackTrace();
        }
        return jsonResult;
    }

    @ApiOperation(value = "日汇总统计", tags = {"getStatisticByDay"}, notes = "日汇总统计")
    @GetMapping("/getStatisticByDay")
    public JSONResult<Object> getStatisticByDay(
            @ApiParam(value = "账户信息实体类", name = "VirtualRechargeTrans") VirtualRechargeTrans virtualRechargeTrans) {
        JSONResult<Object> jsonResult = new JSONResult<>();
        try {
            Map map = this.service.getStatisticByDay(virtualRechargeTrans);
            jsonResult.setData(map);
            jsonResult.setMessage("操作成功");
            jsonResult.setSuccess(true);
            jsonResult.setCode(200);
        } catch (Exception e) {
            jsonResult.setMessage(e.getLocalizedMessage());
            jsonResult.setSuccess(false);
            e.printStackTrace();
        }
        return jsonResult;
    }

    @ApiOperation(value = "分页查询提现月汇总数据集", tags = {"getVirtualTransExcelPagesMonth"}, notes = "分页查询提现月汇总数据集")
    @GetMapping("/getVirtualTransExcelPagesMonth")
    public JSONResult<List<VirtualRechargeTrans>> getVirtualTransExcelPagesMonth(
            @ApiParam(value = "起始页", name = "pageNo") Integer pageNo,
            @ApiParam(value = "当前页显示数量", name = "pageSize") Integer pageSize,
            @ApiParam(value = "账户信息实体类", name = "VirtualRechargeTrans") VirtualRechargeTrans virtualRechargeTrans) {
        JSONResult<List<VirtualRechargeTrans>> jsonResult = new JSONResult<>();
        try {
            IPage<VirtualRechargeTrans> result = this.service.selectVirtualTransExcelPagesMonth(new Page<>(pageNo, pageSize), virtualRechargeTrans);
            jsonResult.setTotal(result.getTotal());
            jsonResult.setData(result.getRecords());
            jsonResult.setMessage("操作成功");
            jsonResult.setSuccess(true);
            jsonResult.setCode(200);
        } catch (Exception e) {
            jsonResult.setMessage(e.getLocalizedMessage());
            jsonResult.setSuccess(false);
            e.printStackTrace();
        }
        return jsonResult;
    }

    @ApiOperation(value = "月汇总统计", tags = {"getStatisticByMonth"}, notes = "月汇总统计")
    @GetMapping("/getStatisticByMonth")
    public JSONResult<Object> getStatisticByMonth(
            @ApiParam(value = "账户信息实体类", name = "VirtualRechargeTrans") VirtualRechargeTrans virtualRechargeTrans) {
        JSONResult<Object> jsonResult = new JSONResult<>();
        try {
            Map map = this.service.getStatisticByMonth(virtualRechargeTrans);
            jsonResult.setData(map);
            jsonResult.setMessage("操作成功");
            jsonResult.setSuccess(true);
            jsonResult.setCode(200);
        } catch (Exception e) {
            jsonResult.setMessage(e.getLocalizedMessage());
            jsonResult.setSuccess(false);
            e.printStackTrace();
        }
        return jsonResult;
    }

    @ApiOperation(value = "分页查询充值日汇总数据集", tags = {"getVirtualRechargePagesDay"}, notes = "分页查询充值日汇总数据集")
    @GetMapping("/getVirtualRechargePagesDay")
    public JSONResult<List<VirtualRechargeTrans>> getVirtualRechargePagesDay(
            @ApiParam(value = "起始页", name = "pageNo") Integer pageNo,
            @ApiParam(value = "当前页显示数量", name = "pageSize") Integer pageSize,
            @ApiParam(value = "账户信息实体类", name = "VirtualRechargeTrans") VirtualRechargeTrans virtualRechargeTrans) {
        JSONResult<List<VirtualRechargeTrans>> jsonResult = new JSONResult<>();
        try {
            IPage<VirtualRechargeTrans> result = this.service.selectVirtualRechargePagesDay(new Page<>(pageNo, pageSize), virtualRechargeTrans);
            jsonResult.setTotal(result.getTotal());
            jsonResult.setData(result.getRecords());
            jsonResult.setMessage("操作成功");
            jsonResult.setSuccess(true);
            jsonResult.setCode(200);
        } catch (Exception e) {
            jsonResult.setMessage(e.getLocalizedMessage());
            jsonResult.setSuccess(false);
            e.printStackTrace();
        }
        return jsonResult;
    }

    @ApiOperation(value = "日汇总统计", tags = {"getStatisticDayRC"}, notes = "日汇总统计")
    @GetMapping("/getStatisticDayRC")
    public JSONResult<Object> getStatisticDayRC(
            @ApiParam(value = "账户信息实体类", name = "VirtualRechargeTrans") VirtualRechargeTrans virtualRechargeTrans) {
        JSONResult<Object> jsonResult = new JSONResult<>();
        try {
            Map map = this.service.getStatisticDayRC(virtualRechargeTrans);
            jsonResult.setData(map);
            jsonResult.setMessage("操作成功");
            jsonResult.setSuccess(true);
            jsonResult.setCode(200);
        } catch (Exception e) {
            jsonResult.setMessage(e.getLocalizedMessage());
            jsonResult.setSuccess(false);
            e.printStackTrace();
        }
        return jsonResult;
    }

    @ApiOperation(value = "分页查询充值月汇总数据集", tags = {"getVirtualRechargePagesMonth"}, notes = "分页查询充值月汇总数据集")
    @GetMapping("/getVirtualRechargePagesMonth")
    public JSONResult<List<VirtualRechargeTrans>> getVirtualRechargePagesMonth(
            @ApiParam(value = "起始页", name = "pageNo") Integer pageNo,
            @ApiParam(value = "当前页显示数量", name = "pageSize") Integer pageSize,
            @ApiParam(value = "账户信息实体类", name = "VirtualRechargeTrans") VirtualRechargeTrans virtualRechargeTrans) {
        JSONResult<List<VirtualRechargeTrans>> jsonResult = new JSONResult<>();
        try {
            IPage<VirtualRechargeTrans> result = this.service.selectVirtualRechargePagesMonth(new Page<>(pageNo, pageSize), virtualRechargeTrans);
            jsonResult.setTotal(result.getTotal());
            jsonResult.setData(result.getRecords());
            jsonResult.setMessage("操作成功");
            jsonResult.setSuccess(true);
            jsonResult.setCode(200);
        } catch (Exception e) {
            jsonResult.setMessage(e.getLocalizedMessage());
            jsonResult.setSuccess(false);
            e.printStackTrace();
        }
        return jsonResult;
    }

    @ApiOperation(value = "月汇总统计", tags = {"getStatisticMonthRC"}, notes = "月汇总统计")
    @GetMapping("/getStatisticMonthRC")
    public JSONResult<Object> getStatisticMonthRC(
            @ApiParam(value = "账户信息实体类", name = "getStatisticMonthRC") VirtualRechargeTrans virtualRechargeTrans) {
        JSONResult<Object> jsonResult = new JSONResult<>();
        try {
            Map map = this.service.getStatisticMonthRC(virtualRechargeTrans);
            jsonResult.setData(map);
            jsonResult.setMessage("操作成功");
            jsonResult.setSuccess(true);
            jsonResult.setCode(200);
        } catch (Exception e) {
            jsonResult.setMessage(e.getLocalizedMessage());
            jsonResult.setSuccess(false);
            e.printStackTrace();
        }
        return jsonResult;
    }
}
